package com.dustedpixels.jasmin.memory;

/**
 * Memory with 16-bit address bus and 8-bit data bus.
 */
public interface Memory16x8 {
    /**
     * Writes value under given address.
     * 
     * @param address The address.
     * @param value The value.
     */
    void poke(short address, byte value);

    /**
     * Returns value at given address.
     * 
     * @param address The address.
     * @return The value.
     */
    byte peek(short address);

    /**
     * Returns the mask which will be applied to address before memory access.
     * 
     * @return The mask;
     */
    short getAddressMask();

    /**
     * Returns the mask which will be applied to the data before memory access.
     * 
     * @return The mask;
     */
    byte getDataMask();

    /**
     * Fast version of poke, which assumes that the address and the data are
     * already masked.
     * 
     * @param address The address
     * @param data The data
     */
    void fastPoke(short address, byte data);

    /**
     * Fast version of peek, which assumes that the address is already masked.
     * 
     * @param address The address
     * @returns The data
     */
    byte fastPeek(short address);
}
